<!DOCTYPE html>

<html xmlns:th="http://www.thymeleaf.org">

<head>
    <base th:href="${#request.getContextPath()}+'/static/'">
    <meta charset="UTF-8">

    <title>zTree 最简单的树</title>
    <link rel="stylesheet" type="text/css" href="plugins/ztree/css/bootstrapStyle/bootstrapStyle.css"/>
<!--    <link rel="stylesheet" type="text/css" href="plugins/ztree/css/demo.css"/>-->
    <script type="text/javascript" src="/static/plugins/ztree/js/jquery.min.js"></script>
    <script type="text/javascript" src="/static/plugins/ztree/js/jquery.ztree.core.js"></script>
    <script type="text/javascript" src="/static/plugins/ztree/js/jquery.ztree.excheck.js"></script>
    <script type="text/javascript" src="/static/plugins/ztree/js/jquery.ztree.exedit.js"></script>
    <SCRIPT type="text/javascript" >

        var zTree;
        var demoIframe;

        var setting = {
            check:{
                enable: true
            },
            data: {
                simpleData: {
                    enable:true,
                    idKey: "idKey",
                    pIdKey: "pidKey",
                    rootPId: "0"
                },
                key:{
                  name:"title"
                }
            },

        };

        // var zNodes =[
        //     {id:1, pid:0, title:"[core] 基本功能 演示", open:true},
        //     {id:101, pid:1, title:"最简单的树 --  标准 JSON 数据", file:"core/standardData"},
        //     {id:102, pid:1, title:"最简单的树 --  简单 JSON 数据", file:"core/simpleData"},
        //     {id:103, pid:1, title:"不显示 连接线", file:"core/noline"},
        //     {id:104, pid:1, title:"不显示 节点 图标", file:"core/noicon"},
        //     {id:105, pid:1, title:"自定义图标 --  icon 属性", file:"core/custom_icon"},
        //     {id:106, pid:1, title:"自定义图标 --  iconSkin 属性", file:"core/custom_iconSkin"},
        //     {id:107, pid:1, title:"自定义字体", file:"core/custom_font"},
        //     {id:115, pid:1, title:"超链接演示", file:"core/url"},
        //     {id:108, pid:1, title:"异步加载 节点数据", file:"core/async"},
        //     {id:109, pid:1, title:"用 zTree 方法 异步加载 节点数据", file:"core/async_fun"},
        //     {id:110, pid:1, title:"用 zTree 方法 更新 节点数据", file:"core/update_fun"},
        //     {id:111, pid:1, title:"单击 节点 控制", file:"core/click"},
        //     {id:112, pid:1, title:"展开 / 折叠 父节点 控制", file:"core/expand"},
        //     {id:113, pid:1, title:"根据 参数 查找 节点", file:"core/searchNodes"},
        //     {id:114, pid:1, title:"其他 鼠标 事件监听", file:"core/otherMouse"},
        //
        //     {id:2, pid:0, title:"[excheck] 复/单选框功能 演示", open:false},
        //     {id:201, pid:2, title:"Checkbox 勾选操作", file:"excheck/checkbox"},
        //     {id:206, pid:2, title:"Checkbox nocheck 演示", file:"excheck/checkbox_nocheck"},
        //     {id:207, pid:2, title:"Checkbox chkDisabled 演示", file:"excheck/checkbox_chkDisabled"},
        //     {id:208, pid:2, title:"Checkbox halfCheck 演示", file:"excheck/checkbox_halfCheck"},
        //     {id:202, pid:2, title:"Checkbox 勾选统计", file:"excheck/checkbox_count"},
        //     {id:203, pid:2, title:"用 zTree 方法 勾选 Checkbox", file:"excheck/checkbox_fun"},
        //     {id:204, pid:2, title:"Radio 勾选操作", file:"excheck/radio"},
        //     {id:209, pid:2, title:"Radio nocheck 演示", file:"excheck/radio_nocheck"},
        //     {id:210, pid:2, title:"Radio chkDisabled 演示", file:"excheck/radio_chkDisabled"},
        //     {id:211, pid:2, title:"Radio halfCheck 演示", file:"excheck/radio_halfCheck"},
        //     {id:205, pid:2, title:"用 zTree 方法 勾选 Radio", file:"excheck/radio_fun"},
        //
        //     {id:3, pid:0, title:"[exedit] 编辑功能 演示", open:false},
        //     {id:301, pid:3, title:"拖拽 节点 基本控制", file:"exedit/drag"},
        //     {id:302, pid:3, title:"拖拽 节点 高级控制", file:"exedit/drag_super"},
        //     {id:303, pid:3, title:"用 zTree 方法 移动 / 复制 节点", file:"exedit/drag_fun"},
        //     {id:304, pid:3, title:"基本 增 / 删 / 改 节点", file:"exedit/edit"},
        //     {id:305, pid:3, title:"高级 增 / 删 / 改 节点", file:"exedit/edit_super"},
        //     {id:306, pid:3, title:"用 zTree 方法 增 / 删 / 改 节点", file:"exedit/edit_fun"},
        //     {id:307, pid:3, title:"异步加载 & 编辑功能 共存", file:"exedit/async_edit"},
        //     {id:308, pid:3, title:"多棵树之间 的 数据交互", file:"exedit/multiTree"},
        //
        //     {id:4, pid:0, title:"大数据量 演示", open:false},
        //     {id:401, pid:4, title:"一次性加载大数据量", file:"bigdata/common"},
        //     {id:402, pid:4, title:"分批异步加载大数据量", file:"bigdata/diy_async"},
        //     {id:403, pid:4, title:"分批异步加载大数据量", file:"bigdata/page"},
        //
        //     {id:5, pid:0, title:"组合功能 演示", open:false},
        //     {id:501, pid:5, title:"冻结根节点", file:"super/oneroot"},
        //     {id:502, pid:5, title:"单击展开/折叠节点", file:"super/oneclick"},
        //     {id:503, pid:5, title:"保持展开单一路径", file:"super/singlepath"},
        //     {id:504, pid:5, title:"添加 自定义控件", file:"super/diydom"},
        //     {id:505, pid:5, title:"checkbox / radio 共存", file:"super/checkbox_radio"},
        //     {id:506, pid:5, title:"左侧菜单", file:"super/left_menu"},
        //     {id:513, pid:5, title:"OutLook 风格", file:"super/left_menuForOutLook"},
        //     {id:515, pid:5, title:"Awesome 风格", file:"super/awesome"},
        //     {id:514, pid:5, title:"Metro 风格", file:"super/metro"},
        //     {id:507, pid:5, title:"下拉菜单", file:"super/select_menu"},
        //     {id:509, pid:5, title:"带 checkbox 的多选下拉菜单", file:"super/select_menu_checkbox"},
        //     {id:510, pid:5, title:"带 radio 的单选下拉菜单", file:"super/select_menu_radio"},
        //     {id:508, pid:5, title:"右键菜单 的 实现", file:"super/rightClickMenu"},
        //     {id:511, pid:5, title:"与其他 DOM 拖拽互动", file:"super/dragWithOther"},
        //     {id:512, pid:5, title:"异步加载模式下全部展开", file:"super/asyncForAll"},
        //
        //     {id:6, pid:0, title:"其他扩展功能 演示", open:false},
        //     {id:601, pid:6, title:"隐藏普通节点", file:"exhide/common"},
        //     {id:602, pid:6, title:"配合 checkbox 的隐藏", file:"exhide/checkbox"},
        //     {id:603, pid:6, title:"配合 radio 的隐藏", file:"exhide/radio"}
        // ];
        //初始化树
        $(document).ready(function(){
            var t = $("#tree");
            //将zNodes数据替换成后端查询的数据 注意：数据以json对象数据存入
            t = $.fn.zTree.init(t, setting, JSON.parse($("#menuJson").val()));
        });

        //-->
    </SCRIPT>
</HEAD>

<BODY>

            <ul id="tree" class="ztree" style="width:260px; overflow:auto;"></ul>
        <input type="hidden" th:value="${menus}" id="menuJson"/>

</BODY>
</HTML>